﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Text;
using System.Web.SessionState;

namespace jnagr.Web.devinfo
{
    /// <summary>
    /// GetDev 的摘要说明
    /// </summary>
    public class GetDev : IHttpHandler, IRequiresSessionState
    {
        StringBuilder result = new StringBuilder();
        StringBuilder sb = new StringBuilder();
        StringBuilder rechild = new StringBuilder();
        jnagr.BLL.devinfo bll = new jnagr.BLL.devinfo();
        BLL.userdevinfo bllu = new BLL.userdevinfo();
        public void ProcessRequest(HttpContext context)
        {

            string ac = "";
            if (null != context.Request.Form["action"])
            {//获取前台传来的值  
                ac = context.Request.Form["action"].ToString().Trim();
            }
            else if (null != context.Request.QueryString["action"])
            {
                ac = context.Request.QueryString["action"].ToString().Trim();
            }

            if (ac == "query")
                Query(context);
            else if (ac == "add")
                add(context);
            else if (ac == "adduserdev")
                adduserdev(context);
            else if (ac == "queryt")
                QueryT(context);    
            else if (ac == "modify")
                modify(context);
            else if (ac == "delete")
                delete(context);
            else if (ac == "deleteuserdev")
                deleteuserdev(context);
                
            else if (ac == "ddllist")
                ddllist(context);
            else if (ac == "querydev")
                Querydev(context);
            else if (ac == "queryuserdev")
                Queryuserdev(context);
            else if (ac == "queryxqh")
                Queryxqh(context);
            else if (ac == "querycbd")
                Querycbd(context);
        }
        public void Querycbd(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {

                string ybqname = "", ybqid = "";
                string devid = context.Request.QueryString["devid"];
               
                ybqname = bll.getYBQ(devid,"PIC");
                if (ybqname.Contains(","))
                {
                    ybqid = ybqname.Substring(0, ybqname.IndexOf(","));
                    ybqname = ybqname.Substring(ybqname.IndexOf(",") + 1);
                    string json = "[{\"ybqid\":\"" + ybqid + "\",\"ybqch\":\"" + ybqname + "\"}]";
                    context.Response.Write(json);
                    context.Response.End();
                }
                else
                {
                    string json = "[{\"cbdid\":\""+ybqname+"\"}]";
                    context.Response.Write(json);
                    context.Response.End();
                }
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();

            }
        }
        public void Queryxqh(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {               
               
                string ybqname = "",ybqid="";
                string devid = context.Request.QueryString["devid"];
                ybqname = bll.getYBQ(devid,"PICSB");
                if (ybqname.Contains(","))
                {
                    ybqid = ybqname.Substring(0, ybqname.IndexOf(","));
                    ybqname = ybqname.Substring(ybqname.IndexOf(",")+1);
                    string json = "[{\"ybqid\":\"" + ybqid + "\",\"ybqch\":\"" + ybqname + "\"}]";
                    context.Response.Write(json);
                    context.Response.End();
                }
                else
                {
                    string json = "[{\"ybqid\":\"\",\"ybqch\":\"\"}]";
                    context.Response.Write(json);
                    context.Response.End();
                }
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();

            }
        }
        public void QueryT(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {
                string sebm = "";                
                //================================================================  
                //获取分页和排序信息：页大小，页码，排序方式，排序字段  
                int pageRows, page;
                pageRows = 1000;
                page = 1;
                string sort= "",order="",orderby="";
                if (null != context.Request.Form["sebm"])
                {
                    sebm = context.Request.Form["sebm"].ToString().Trim();
                }
                StringBuilder strWhere = new StringBuilder();                
                if (sebm != "" && sebm != "0")
                {
                    if (sebm.Length == 6)
                    {

                        if (sebm.EndsWith("0000"))
                        {
                            strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm.Substring(0, 2));
                        }
                        else if (sebm.EndsWith("00"))
                        {
                            strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm.Substring(0, 4));
                        }
                        else
                        {
                            strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm);
                        }
                    }
                    else
                    {
                        strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm);
                    }
                }
                else
                {
                    string[] pcc = Web.Admin.myinfo.getPCC(context).Split(',');
                    string add = string.Join("", pcc);
                    strWhere.AppendFormat(" DevLocation like '%{0}%' and ", add);

                }
                //strWhere.AppendFormat(" uid={0} and ", uid);
                //删除多余的and  
                int startindex = strWhere.ToString().LastIndexOf("and");//获取最后一个and的位置  
                if (startindex >= 0)
                {
                    strWhere.Remove(startindex, 3);//删除多余的and关键字  
                }
                if (sort != "" && order != "")
                {
                    orderby = order + " " + sort;
                }
                DataSet ds = bll.GetListByPage(strWhere.ToString(), orderby, (page - 1) * pageRows + 1, page * pageRows);
                string str = GetTreeJsonByTableOne(ds.Tables[0], "DevID", "devname");               
                context.Response.Write(str);//返回给前台页面  
                context.Response.End();
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();

            }
        }
        public void ddllist(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {

                DataSet ds = bll.GetList("");
                string strJson = ToJson.DataTable2Json1(ds.Tables[0]);//DataSet数据转化为Json数据  
                context.Response.Write(strJson);//返回给前台页面  
                context.Response.End();
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();

            }
        }
        public void delete(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {
                int dpid = 0;
                string uidstr = context.Request.QueryString["KeyId"];
                if (uidstr != "")
                    dpid = int.Parse(uidstr);
                if (bll.Delete(dpid))
                {
                    context.Response.Write("T");//返回给前台页面  
                    context.Response.End();
                }
                else
                {
                    context.Response.Write("F");//返回给前台页面  
                    context.Response.End();
                }
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();
            }
        }
        public void deleteuserdev(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {
                int dpid = 0;
                string uidstr = context.Request.QueryString["udid"];
                if (uidstr != "")
                    dpid = int.Parse(uidstr);
                if (bllu.Delete(dpid))
                {
                    context.Response.Write("T");//返回给前台页面  
                    context.Response.End();
                }
                else
                {
                    context.Response.Write("F");//返回给前台页面  
                    context.Response.End();
                }
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();
            }
        }
        public void modify(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {
                int KeyId = 0;
                string uidstr = context.Request.Form["KeyId"];
                if (uidstr != "")
                    KeyId = int.Parse(uidstr);                
                string DevType = context.Request.Form["DevType"];
                string DevID = context.Request.Form["DevID"];
                string devname = context.Request.Form["devname"];
                string DevLocation = context.Request.Form["DevLocation"];
                string DevOwnerName = context.Request.Form["DevOwnerName"];
                string DevOwnerID = context.Request.Form["DevOwnerID"];
                string DevContact = context.Request.Form["DevContact"];
                string XQHID = context.Request.Form["XQHID"];
                string chn0 = context.Request.Form["chn0"];
                string chn1 = context.Request.Form["chn1"];
                string chn2 = context.Request.Form["chn2"];
                string chn3 = context.Request.Form["chn3"];
                decimal mjd = decimal.Parse(context.Request.Form["mjd"]);
                decimal mwd = decimal.Parse(context.Request.Form["mwd"]);
                string yjd = context.Request.Form["yjd"];
                string ywd = context.Request.Form["ywd"];
                string yhb = context.Request.Form["yhb"];
                string mq_indexCode = context.Request.Form["mq_indexCode"];
                string mq_ip = context.Request.Form["mq_ip"];
                string mq_port = context.Request.Form["mq_port"];
                string mq_username = context.Request.Form["mq_username"];
                string mq_password = context.Request.Form["mq_password"];
                string mmark = context.Request.Form["mmark"];
                string hmpic = context.Request.Form["mpic"];
                string savepath = "";
                HttpFileCollection files = context.Request.Files;
                if (files.Count == 1)
                {
                    HttpPostedFile file = files[0];
                    if (file.ContentLength > 0)
                    {
                        //全路径  
                        string FullFullName = file.FileName;
                        //获取图片的名称  
                        String fileName = FullFullName.Substring(FullFullName.LastIndexOf("\\") + 1);
                        string exp = fileName.Substring(fileName.LastIndexOf('.')).ToLower();
                        string filenames = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        string path = "~/mpics";
                        savepath = "/mpics";
                        if (exp == ".jpg" || exp == ".bmp" || exp == ".gif" || exp == ".png")
                        {
                            file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(path) + "\\" + filenames + exp);
                            savepath += "/" + filenames + exp;
                        }
                        else
                        {
                            context.Response.Write("P");//返回给前台页面  
                            context.Response.End();

                        }
                    }
                    else
                    {
                        savepath = hmpic;

                    }
                }
                else
                {
                    savepath = hmpic;

                }

                jnagr.Model.devinfo model = new jnagr.Model.devinfo();
                model.KeyId = KeyId;
                model.DevType = DevType;
                model.DevID = DevID;
                model.devname = devname;
                model.DevLocation = DevLocation;
                model.DevOwnerName = DevOwnerName;
                model.DevOwnerID = DevOwnerID;
                model.DevContact = DevContact;
                model.XQHID = XQHID;
                model.chn0 = chn0;
                model.chn1 = chn1;
                model.chn2 = chn2;
                model.chn3 = chn3;
                model.mjd = mjd;
                model.mwd = mwd;
                model.yjd = yjd;
                model.ywd = ywd;
                model.yhb = yhb;
                model.mq_indexCode = mq_indexCode;
                model.mq_ip = mq_ip;
                model.mq_password = mq_password;
                model.mq_username = mq_username;
                model.mq_port = mq_port;
                model.mmark = mmark;
                model.mpic = savepath;

                if (bll.Update(model))
                {
                    context.Response.Write("T");//返回给前台页面  
                    context.Response.End();
                }
                else
                {
                    context.Response.Write("F");//返回给前台页面  
                    context.Response.End();
                }
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();
            }
        }
        public void add(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {                
                string DevType = context.Request.Form["DevType"];
                string DevID = context.Request.Form["DevID"];
                string devname = context.Request.Form["devname"];
                string DevLocation = context.Request.Form["DevLocation"];
                string DevOwnerName = context.Request.Form["DevOwnerName"];
                string DevOwnerID = context.Request.Form["DevOwnerID"];
                string DevContact = context.Request.Form["DevContact"];
                string XQHID = context.Request.Form["XQHID"];
                string chn0 = context.Request.Form["chn0"];
                string chn1 = context.Request.Form["chn1"];
                string chn2 = context.Request.Form["chn2"];
                string chn3 = context.Request.Form["chn3"];
                string yjd = context.Request.Form["yjd"];
                string ywd = context.Request.Form["ywd"];
                string yhb = context.Request.Form["yhb"];
                string mq_indexCode = context.Request.Form["mq_indexCode"];
                string mq_ip = context.Request.Form["mq_ip"];
                string mq_port = context.Request.Form["mq_port"];
                string mq_username = context.Request.Form["mq_username"];
                string mq_password = context.Request.Form["mq_password"];
                decimal mjd = decimal.Parse(context.Request.Form["mjd"]);
                decimal mwd = decimal.Parse(context.Request.Form["mwd"]);
                DateTime mdatetime = DateTime.Now;
                string mmark = context.Request.Form["mmark"];               
                string savepath = "";
                HttpFileCollection files = context.Request.Files;
                if (files.Count == 1)
                {
                    HttpPostedFile file = files[0];
                    if (file.ContentLength > 0)
                    {
                        //全路径  
                        string FullFullName = file.FileName;
                        //获取图片的名称  
                        String fileName = FullFullName.Substring(FullFullName.LastIndexOf("\\") + 1);
                        string exp = fileName.Substring(fileName.LastIndexOf('.')).ToLower();
                        string filenames = DateTime.Now.ToString("yyyyMMddHHmmssfff");
                        string path = "~/mpics";
                        savepath = "/mpics";
                        if (exp == ".jpg" || exp == ".bmp" || exp == ".gif" || exp == ".png")
                        {
                            file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(path) + "\\" + filenames + exp);
                            savepath += "/" + filenames + exp;
                        }
                        else
                        {
                            context.Response.Write("P");//返回给前台页面  
                            context.Response.End();

                        }
                    }
                }

                jnagr.Model.devinfo model = new jnagr.Model.devinfo();                
                model.DevType = DevType;
                model.DevID = DevID;
                model.devname = devname;
                model.DevLocation = DevLocation;
                model.DevOwnerName = DevOwnerName;
                model.DevOwnerID = DevOwnerID;
                model.DevContact = DevContact;
                model.XQHID = XQHID;
                model.chn0 = chn0;
                model.chn1 = chn1;
                model.chn2 = chn2;
                model.chn3 = chn3;
                model.mjd = mjd;
                model.mwd = mwd;
                model.mdatetime = mdatetime;
                model.changedatetime = mdatetime;
                model.mmark = mmark;
                model.mpic = savepath;
                model.yjd = yjd;
                model.ywd = ywd;
                model.yhb = yhb;
                model.mq_indexCode = mq_indexCode;
                model.mq_ip = mq_ip;
                model.mq_password = mq_password;
                model.mq_username = mq_username;
                model.mq_port = mq_port;
                if (bll.Add(model) > 0)
                {
                    context.Response.Write("T");//返回给前台页面  
                    context.Response.End();
                }
                else
                {
                    context.Response.Write("F");//返回给前台页面  
                    context.Response.End();
                }
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();
            }

        }
        public void adduserdev(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {
                int uuid = 0;
                string DevID = "";
                if (null != context.Request.QueryString["uid"])
                {
                    uuid = int.Parse(context.Request.QueryString["uid"]);
                }
                if (null != context.Request.QueryString["DevID"])
                {
                    DevID = context.Request.QueryString["DevID"].ToString();
                }
                jnagr.Model.userdevinfo model = new jnagr.Model.userdevinfo();
                model.uid = uuid;
                model.devid = DevID;
                model.inputtime = DateTime.Now;
                if (bllu.Add(model) > 0)
                {
                    context.Response.Write("T");//返回给前台页面  
                    context.Response.End();
                }
                else
                {
                    context.Response.Write("F");//返回给前台页面  
                    context.Response.End();
                }
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();
            }

        }
        public void Query(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {
                string uname, utruename, st,sebm="";
                uname = utruename = st = "";
                //获取前台传来的值 
                if (null != context.Request.Form["search_type"])
                {//获取前台传来的值  
                    st = context.Request.Form["search_type"].ToString().Trim();
                }
                if (null != context.Request.Form["search_value"])
                {//获取前台传来的值  
                    uname = context.Request.Form["search_value"].ToString().Trim();
                }
                if (st == "username")
                {
                    utruename = uname;
                    uname = "";
                }
                //================================================================  
                //获取分页和排序信息：页大小，页码，排序方式，排序字段  
                int pageRows, page;
                pageRows = 10;
                page = 1;
                string order, sort, oderby; order = sort = oderby = "";
                if (null != context.Request.Form["rows"])
                {
                    pageRows = int.Parse(context.Request.Form["rows"].ToString().Trim());
                }
                if (null != context.Request.Form["page"])
                {
                    page = int.Parse(context.Request.Form["page"].ToString().Trim());
                }
                if (null != context.Request.Form["sort"])
                {
                    order = context.Request.Form["sort"].ToString().Trim();
                }
                if (null != context.Request.Form["order"])
                {
                    sort = context.Request.Form["order"].ToString().Trim();
                }
                if (null != context.Request.Form["sebm"])
                {
                    sebm = context.Request.Form["sebm"].ToString().Trim();
                }
                StringBuilder strWhere = new StringBuilder();
                if (uname != "")
                {
                    strWhere.AppendFormat(" DevType like '%{0}%' and ", uname);
                }
                if (utruename != "")
                {
                    strWhere.AppendFormat(" devname like '%{0}%' and ", utruename);
                }
                if (sebm != ""&&sebm!="0")
                {
                    if (sebm.Length == 6)
                    {
                       
                         if (sebm.EndsWith("0000"))
                        {
                            strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm.Substring(0, 2));
                        }
                         else if (sebm.EndsWith("00"))
                        {
                            strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm.Substring(0, 4));
                        }
                        else
                        {
                            strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm);
                        }
                    }
                    else
                    {
                        strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm);
                    }
                }
                else
                {
                    string[] pcc = Web.Admin.myinfo.getPCC(context).Split(',');
                    string add = string.Join("", pcc);
                    strWhere.AppendFormat(" DevLocation like '%{0}%' and ", add);

                }
                //strWhere.AppendFormat(" uid={0} and ", uid);
                //删除多余的and  
                int startindex = strWhere.ToString().LastIndexOf("and");//获取最后一个and的位置  
                if (startindex >= 0)
                {
                    strWhere.Remove(startindex, 3);//删除多余的and关键字  
                }
                if (sort != "" && order != "")
                {
                    oderby = order + " " + sort;
                }
                DataSet ds = bll.GetListByPage(strWhere.ToString(), oderby, (page - 1) * pageRows + 1, page * pageRows);
                int count = bll.GetRecordCount(strWhere.ToString());//获取条数  
                string strJson = ToJson.Dataset2Json(ds, count);//DataSet数据转化为Json数据  
                context.Response.Write(strJson);//返回给前台页面  
                context.Response.End();
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();

            }
        }
        public void Querydev(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {
                string dtype="", sebm = "";
                
                //获取前台传来的值 
                if (null != context.Request.Form["dtype"])
                {//获取前台传来的值  
                    dtype = context.Request.Form["dtype"].ToString().Trim();
                }
                
                //================================================================  
                //获取分页和排序信息：页大小，页码，排序方式，排序字段  
                int pageRows, page;
                pageRows = 10;
                page = 1;
                string order, sort, oderby; order = sort = oderby = "";
                
                if (null != context.Request.Form["sebm"])
                {
                    sebm = context.Request.Form["sebm"].ToString().Trim();
                }
                StringBuilder strWhere = new StringBuilder();
                if (dtype != "")
                {
                    strWhere.AppendFormat(" DevType='{0}' and ", dtype);
                }
                if (sebm != "" && sebm != "0")
                {
                    if (sebm.Length == 6)
                    {

                        if (sebm.EndsWith("0000"))
                        {
                            strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm.Substring(0, 2));
                        }
                        else if (sebm.EndsWith("00"))
                        {
                            strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm.Substring(0, 4));
                        }
                        else
                        {
                            strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm);
                        }
                    }
                    else
                    {
                        strWhere.AppendFormat(" DevOwnerID like '{0}%' and ", sebm);
                    }
                }
                else
                {
                    string[] pcc = Web.Admin.myinfo.getPCC(context).Split(',');
                    string add = string.Join("", pcc);
                    strWhere.AppendFormat(" DevLocation like '%{0}%' and ", add);

                }
                //strWhere.AppendFormat(" uid={0} and ", uid);
                //删除多余的and  
                int startindex = strWhere.ToString().LastIndexOf("and");//获取最后一个and的位置  
                if (startindex >= 0)
                {
                    strWhere.Remove(startindex, 3);//删除多余的and关键字  
                }
                if (sort != "" && order != "")
                {
                    oderby = order + " " + sort;
                }
                DataSet ds = bll.GetListByPage(strWhere.ToString(), oderby, (page - 1) * pageRows + 1, page * pageRows);
                int count = bll.GetRecordCount(strWhere.ToString());//获取条数  
                string strJson = ToJson.Dataset2Json(ds, count);//DataSet数据转化为Json数据  
                context.Response.Write(strJson);//返回给前台页面  
                context.Response.End();
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();

            }
        }
        public void Queryuserdev(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int uid = Web.Admin.myinfo.getID(context);
            if (uid != 0)
            {
               
                int uuid = 0;
                if (null != context.Request.Form["uid"])
                {//获取前台传来的值  
                    uuid =int.Parse( context.Request.Form["uid"].ToString().Trim());
                }

                //================================================================  
                //获取分页和排序信息：页大小，页码，排序方式，排序字段  
                int pageRows, page;
                pageRows = 100;
                page = 1;
                string order, sort, oderby; order = sort = oderby = "";
                oderby = "inputtime desc";
               
                StringBuilder strWhere = new StringBuilder();                
                strWhere.AppendFormat(" uid={0} and ", uuid);
                //删除多余的and  
                int startindex = strWhere.ToString().LastIndexOf("and");//获取最后一个and的位置  
                if (startindex >= 0)
                {
                    strWhere.Remove(startindex, 3);//删除多余的and关键字  
                }
                if (sort != "" && order != "")
                {
                    oderby = order + " " + sort;
                }
                

                DataSet ds = bllu.GetListByPage(strWhere.ToString(), oderby, (page - 1) * pageRows + 1, page * pageRows);
                string str = GetTreeJsonByTableOne(ds.Tables[0], "udid", "devname");
                context.Response.Write(str);//返回给前台页面  
                context.Response.End();
            }
            else
            {
                context.Response.Write("L");//返回给前台页面  
                context.Response.End();

            }
        }
        private string GetTreeJsonByTableOne(DataTable tabel, string idCol, string txtCol)
        {
            result.Remove(0, result.Length);
            if (tabel.Rows.Count > 0)
            {
                result.Append("[");

                foreach (DataRow row in tabel.Rows)
                {
                    result.Append("{\"id\":\"" + row[idCol] + "\",\"text\":\"" + row[txtCol] + "\",\"DevID\":\"" + row["DevID"] + "\",\"DevType\":\"" + row["DevType"] + "\"},");
                }
                result = result.Remove(result.Length - 1, 1);

                result.Append("]");

            }
            return result.ToString();
        }
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}